===================================================
Google reCAPTCHA for Zen Cart v3.6
===================================================
Released under the GPL License 2.0
This Plugin inserts a Google reCAPTCHA v2 into the Contact-us page, Create Account page, Write a Review and Ask a Question  page to try to stop automated spam submissions.

===================================================
Files included with this Plugin:
===================================================
	/includes/auto_loaders/config.google_recaptcha.php
	/includes/classes/observers/class.google_recaptcha.php
	/includes/classes/observers/google/autoload.php
	/includes/classes/observers/google/ReCaptcha/Response.php
	/includes/classes/observers/google/ReCaptcha/ReCaptcha.php
	/includes/classes/observers/google/ReCaptcha/RequestMethod.php
	/includes/classes/observers/google/ReCaptcha/RequestParameters.php
	/includes/classes/observers/google/ReCaptcha/RequestMethod/Curl.php
	/includes/classes/observers/google/ReCaptcha/RequestMethod/Post.php
	/includes/classes/observers/google/ReCaptcha/RequestMethod/Socket.php
	/includes/classes/observers/google/ReCaptcha/RequestMethod/SocketPost.php
	/includes/functions/extra_functions/recaptchalib.php
	/includes/languages/english/extra_definitions/reCaptcha.php
	/licence.txt --- GPL License 2.0
	/README-Google-reCAPTCHA.txt - this file
	
THEN if you're using pre-156, please use an earlier version of this plugin.

===================================================
Installation for all versions:
===================================================
Step 1
	Go to https://www.google.com/recaptcha/admin and create the Google reCAPTCHA (v2) keys for your website & backup your website's files

Step 2
	Open the file includes/functions/extra_functions/recaptchalib.php and insert the public and secret keys you got in Step 1. They need to go on lines 9 and 10
    
Step 2B 
    If you don't want to use the captcha on all of the included pages edit includes/classes/observers/class.google_recaptcha.php
     find
		//comment out any pages you do NOT want to check
		$pages_to_check[] =  'NOTIFY_CONTACT_US_CAPTCHA_CHECK';
		$pages_to_check[] =  'NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK';
		$pages_to_check[] =  'NOTIFY_REVIEWS_WRITE_CAPTCHA_CHECK';
		$pages_to_check[] =  'NOTIFY_ASK_A_QUESTION_CAPTCHA_CHECK';
		$this->attach($this,$pages_to_check);
        
     Example for just the contact & ask a question pages replace like below           

		//comment out any pages you do NOT want to check
		$pages_to_check[] =  'NOTIFY_CONTACT_US_CAPTCHA_CHECK';
		//$pages_to_check[] =  'NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK';
		//$pages_to_check[] =  'NOTIFY_REVIEWS_WRITE_CAPTCHA_CHECK';
		$pages_to_check[] =  'NOTIFY_ASK_A_QUESTION_CAPTCHA_CHECK';
		$this->attach($this,$pages_to_check); 
        
Step 3
     Edit the files you wish to use captcha in includes/templates/YOUR_TEMPLATE/templates
        tpl_contact_us_default.php 
        tpl_create_account_default.php 
        tpl_product_reviews_write_default.php
        tpl_ask_a_question_default.php

     In each case, you will be adding the line 
        <?php echo recaptcha_get_html(false); ?>

     These are the changes for responsive_classic: 
     a. tpl_contact_us_default.php  
        After the last </fieldset>
        Add <?php echo recaptcha_get_html(false); ?>

     b. tpl_modules_create_account.php
        After the fieldset close for ENTRY_PASSWORD_CONFIRMATION.
        Add <?php echo recaptcha_get_html(false); ?>

     c. tpl_product_reviews_write_default.php
        After <?php echo zen_draw_input_field($antiSpamFieldName, '', ' size="60" id="RAS" style="visibility:hidden; display:none;" autocomplete="off"'); ?>
        Add <?php echo recaptcha_get_html(false); ?>

     d. tpl_ask_a_question_default.php 
        After the last </fieldset>
        Add <?php echo recaptcha_get_html(false); ?>

For the bootstrap template, the changes are a bit different: 
     In each case, you will be adding the line 
        <?php echo recaptcha_get_html(false); ?>

     a. tpl_contact_us_default.php 
     After the CUAS field 
     Add <?php echo recaptcha_get_html(false); ?>
     
     b. tpl_modules_create_account.php 
     Before newsletterDetails-card. 
     Add <?php echo recaptcha_get_html(false); ?>

     c. tpl_product_reviews_write_default.php
     After the RAS field 
     Add <?php echo recaptcha_get_html(false); ?>
     
     d. tpl_ask_a_question_default.php 
     After the CUAS field 
     Add <?php echo recaptcha_get_html(false); ?>

Step 4
	Upload all files to your server and it should all just work.

BASIC INSTALLATION COMPLETE

===================================================
Customization Options
===================================================
The function recaptcha_get_html($fieldset=false, $theme='light', $size='normal') used in step 3 has three optional parameters 
	1	Fieldset flase/true (default is false)	whether to wrap the html in a fieldset - The create account page provided has this set to true.
	2	Theme	light/dark (default is light)	whether to use the light of dark theme for the reCaptcha
	3	Size	normal/compact (default is normal)	whether to use the normal or compact size for the reCaptcha
So to display a small dark reCaptcha surrounded by a fieldset you would use <?php recaptcha_get_html(true, 'dark', 'compact'); ?>

If your server doesn't allow the use of file_get_contents() with external urls, there are two other methods provided - fsockopen() and curl. To use them comment out the default method (line 31) and uncomment the approriate line (line 35 or 37) in /includes/classes/observers/class.google.recaptcha

===================================================
Languages
===================================================
This plugin includes english by default. To use in another language you will need to copy /includes/languages/english/extra_definitions/reCaptcha.php to /includes/languages/YOUR_LANGUAGE/extra_definitions/reCaptcha.php and translate the error messages. In addition Google will display the reCaptcha in your chosen language if you add the parameter hl and a language code to /includes/functions/extra_functions/recaptchalib.php (see line 35 and French example on line 36). However if no language code is used Google will automatically detect the users language based on their browser settings (probably best to allow this rather than force a language).

===================================================	
Problems 
===================================================
See the support page on the Zen Cart Forums - http://www.zen-cart.com/showthread.php?198357-Support-Thread-for-Google-reCAPTCHA 

===================================================
Version History
===================================================
1.0	21 July 12	Initial Version
1.1	24 July 12	Corrected cut'n'paste error in /includes/modules/YOUR_TEMPLATE/create_account.php and updated Step 5 instructions to match.
2.0	21 Sept 12	Changed to use Zen Cart 1.5.1 notification hooks and an observer class. 
			Added detection for SSL pages.
			Uses zen_get_ip_address() instead of $_SERVER["REMOTE_ADDR"]. 
3.0	7 July 15	Completely new version created to use Google reCaptcha v2 ('I am not a robot')
			Classes are namespaced
			Optional curl and fsockopen methods included
3.1	7 July 15	Correct typo in Readme file, init $pages_to_check as array, correct misspelt directory name
3.2  Feb 2017 - Included modified v1.5.5 files for convenience.
3.3  Dec 2018 - updated for PHP 7.X
3.4  Apr 2019 - Updated to auto-disable if missing $publickey. Also included v139 files for convenience.
3.5  Nov 2022 - Removed old versions, removed template files, updated instructions. 
3.6  January 2023 - Added ask a question to captcha class, updated instructions.

